@import security._
@import be.objectify.deadbolt.scala.views.html._
@import be.objectify.deadbolt.scala.AuthenticatedRequest
@(handler: be.objectify.deadbolt.scala.DeadboltHandler)(implicit request: AuthenticatedRequest[Any])

<div class="row-fluid" id="template-dynamic">
    <div class="span10">
        <h3 class="subsection">dynamic</h3>

        <p>dynamic is the most powerful constraint in Deadbolt.  It enforces arbitrary rules.  See the documentation for a full overview.</p>
    </div>
</div>

<div class="row-fluid">
    <div class="span3 columnHeader">Unprotected content</div>
    <div class="span5 columnHeader">Specification</div>
    <div class="span2 columnHeader">Result</div>
</div>

<div class="row-fluid">
    <div class="span3">
        <pre>This content may be visible, depending on your luck</pre>
    </div>
    <div class="span5">
        <pre>
@@dynamic(handler, "pureLuck") {
  This content may be visible, depending on your luck
}</pre>
    </div>
    <div class="span2">
        @dynamic(handler, "pureLuck") {
        This content may be visible, depending on your luck
        }
    </div>
</div>

<div class="row-fluid">
    <div class="span3">
        <pre>This content should NOT be visible</pre>
    </div>
    <div class="span5">
        <pre>
@@dynamic(new MyDeadboltHandler(MyAlternativeDynamicResourceHandler), "pureLuck") {
  This content should NOT be visible
}</pre>
    </div>
    <div class="span2">
        @dynamic(new MyDeadboltHandler(Some(MyAlternativeDynamicResourceHandler)), "pureLuck") {
        This content should NOT be visible
        }
    </div>
</div>

<div class="row-fluid">
    <div class="span3">
        <pre>This content may be visible, depending on your luck</pre>
    </div>
    <div class="span5">
        <pre>
@@dynamicOr(handler, "pureLuck") {
  This content may be visible, depending on your luck
}{Guess you were unlucky}</pre>
    </div>
    <div class="span2">
        @dynamicOr(handler, "pureLuck") {
        This content may be visible, depending on your luck
        }{Guess you were unlucky}
    </div>
</div>

<div class="row-fluid">
    <div class="span3">
        <pre>This content should NOT be visible</pre>
    </div>
    <div class="span5">
        <pre>
@@dynamicOr(new MyDeadboltHandler(MyAlternativeDynamicResourceHandler), "pureLuck") {
  This content should NOT be visible
}{Guess you were unlucky}</pre>
    </div>
    <div class="span2">
        @dynamicOr(new MyDeadboltHandler(Some(MyAlternativeDynamicResourceHandler)), "pureLuck") {
        This content should NOT be visible
        }{Guess you were unlucky}
    </div>
</div>
